package com.ostrich.lib_common.utils;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.ostrich.lib_common.R;

import androidx.databinding.BindingAdapter;

/**
 * @Author : yaotianxue
 * @Time : On 2023/10/6 10:30
 * @Description : ImageViewAdapteer
 */
public class ImageViewAdapter {
    @BindingAdapter("android:setImage")
    public static void setImage(ImageView imageView,String url){
        Glide.with(imageView)
                .load(url)
                .placeholder(R.drawable.logo)
                .error(R.drawable.logo)
                .transform(new CenterCrop())
                .into(imageView);
    }

    @BindingAdapter("android:setImageNormal")
    public static void setImageNormal(ImageView imageView,String url){
        Glide.with(imageView)
                .load(url)
                .placeholder(R.drawable.logo)
                .error(R.drawable.logo)
                .into(imageView);
    }
}
